import sys
sys.path.append('../kernel')
from model import Model
class Xcurl_1(Model):
    table='city_hotel_xcurl_1'
    def __init__(self):
        # 链接数据库
        super().__init__()
    # 添加城市酒店url
    def add_city_hotel_url(self, url, id):
        sql = "INSERT INTO " + self.table + " SET `url`='%s',cid='%d'" % (url, id)
        self.cursor.execute(sql)
        self.conn.commit()  # 提交
    #获取第1层url
    def get_xcurl(self,id):
        sql="SELECT * FROM "+self.table+" WHERE id>'%d' LIMIT 1" % id
        self.cursor.execute(sql)
        data=self.cursor.fetchone()
        return data
    def __del__(self):
        #计数数据库链接
        self.cursor.close()
        self.conn.close()
